export const fatory = (name, initData) => {
    const getItem = () => {
        return JSON.parse(localStorage.getItem(name) || initData)
    }
    const setItem = (value) => {
        localStorage.setItem(name, JSON.stringify(value))
    }
    const removeItem = () => {
        localStorage.removeItem(name)
    }
    return {
        setItem,
        getItem,
        removeItem
    }
}